{% extends "books/base.html" %}

{% block title %}
<title>publisher list</title>
{% endblock %}

{% block body %}
<div id="page">
  <h2>Publishers</h2>
  <table class="tab1">
    <thead>
      <tr><th>publisher name</th><th>website</th></tr>
    </thead>
    <tfoot>
      <tr><th>This is the foot of the table</th></tr>
    </tfoot>
    <tbody>
      {% for publisher in publisher_list %}
      <tr>
        <td><a href="{% url 'book:publisher_book' publisher.name %}">{{ publisher.name }}</a></td>
        <td><a href="{{ publisher.website }}">{{ publisher.website }}</a></td>
        <td><a href="{% url 'book:publisher_detail' publisher.id %}">{{ publisher.name  }}</a></td>
        <!--<td><a href="{{ publisher.get_absolute_url }}">{{ publisher.website }} new</a></td>-->
      </tr>
      {% if publisher.book_set.all %}
      <tr>
        <td></td><td>
          <table class="tab11">
            <tr><th>number</th><th>books</th><th>authors</th></tr>
            {% for book in publisher.book_set.all %}
            <tr>
              <td>{{ forloop.counter }}</td>
              <td><a href="{% url 'book:book_detail' book.id %}">{{ book.title }}</a></td>
              <td><ol>
                {% for author in  book.authors_list %}
                <li>
                  {{ author}}
                </li>
                {% endfor %}
              </td>
            </tr>
            {% endfor %}
          </table>
        </td></tr>
      {% endif %}
      {% endfor %}
    </tbody>
  </table>
  <table class="tab2">
    <thead>
      <tr><th>publisher name</th><th>website</th></tr>
    </thead>
    <tfoot>
      <tr><td>This is the foot of the table</td></tr>
    </tfoot>
    <tbody>
      {% for publisher in publisher_list %}
      <tr><td>{{ publisher.name }}</td><td><a href="{{ publisher.website }}">{{ publisher.website }}</a></td><td><a href="">{{ publisher.name  }}</a></td></tr>
      {% if publisher.book_set.all %}
      <tr><td></td><td>
        <table class="tab11">
          <tr><th>number</th><th>books</th><th>authors</th></tr>
          {% for book in publisher.book_set.all %}
          <tr><td>{{ forloop.counter }}</td><td>{{ book.title }}</td>
            <td><ol>
              {% for author in  book.authors_list %}
              <li>
                {{ author}}
              </li>
              {% endfor %}
            </td></tr>
          {% endfor %}
        </table>
      </td></tr>
      {% endif %}
      {% endfor %}
    </tbody>
  </table>

  {# for test and learn(get_context_data: context['new_data']) #}
  <ul>
    <li>{{ new_data.addti1 }}</li>
    <li>{{ new_data.timenow }}</li>
    <li><a href="{% url 'polls:css' %}">polls test_css</a></li>
    <li><a href="{% url 'book:viewfun'  %}">book testview</a></li>

  </ul>
</div>
{% endblock %}







